package com.woniuxy.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 马宇航
 * @Todo: TODO
 * @DateTime: 25/03/11/星期二 16:42
 * @Component: 成都蜗牛学苑
 **/
@Configuration
public class RouteConfig {
    @Bean
    public Queue routeQueue1() {
        return new Queue("routeQueue1", true, false, false);
    }
    @Bean
    public Queue routeQueue2() {
        return new Queue("routeQueue2", true, false, false);
    }
    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange("directExchange");
    }
    @Bean
    public Binding routeBinding1() {
        return BindingBuilder.bind(routeQueue1()).to(directExchange()).with("a");
    }
    //下面两个方法，都是给Queue2 绑定不同的routingkey
    @Bean
    public Binding routeBinding2() {
        return BindingBuilder.bind(routeQueue2()).to(directExchange()).with("a");
    }
    @Bean
    public Binding routeBinding3() {
        return BindingBuilder.bind(routeQueue2()).to(directExchange()).with("b");
    }
}
